﻿using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;

[TestClass()]
public class TripleTest
{
    [TestMethod()]
    public void EqualsTest()
    {
        int a = 2; 
        int b = 4; 
        int c = 6; 
        Triple target = new Triple(a, b, c); 
        Triple other = new Triple(a, b, c);  
        bool expected = true; 
        bool actual = target.Equals(other);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    public void CloneTest()
    {
        int a = 3;
        int b = 5;
        int c = 7;
        Triple original = new Triple(a, b, c);
        object copy = original.Clone();
        Assert.AreEqual(copy ,original);
    }

    [TestMethod()]  
    public void CompareToTestRightLarger()
    {
        Triple left = new Triple(1, 2, 3);
        Triple right = new Triple(3, 4, 5);
        Assert.IsTrue(left.CompareTo(right)<0);
    }

    [TestMethod()]
    public void CompareToTestLeftLarger()
    {
        Triple left = new Triple(-9, 33, -3);
        Triple right = new Triple(3, 4, 5);
        Assert.IsTrue(left.CompareTo(right) > 0);
    }

    [TestMethod()]
    public void op_AdditionTest()
    {
        Triple left = new Triple(1,-2,3); 
        Triple right = new Triple(-4,5,6); 
        Triple expected = new Triple(-3,3,9); 
        Triple actual;
        actual = (left + right);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    public void op_IncrementTest()
    {
        Triple input = new Triple(8,5,-1); 
        Triple expected = new Triple(9,6,0); 
        Triple actual = ++(input);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    public void op_SubtractionTest()
    {
        Triple left = new Triple(8, -15, -1); 
        Triple right = new Triple(9, 6, 0); 
        Triple expected = new Triple(-1, -21, -1); 
        Triple actual = (left - right);
        Assert.AreEqual(expected, actual);
    }

    [TestMethod()]
    public void GetHashCodeTest()
    {
        int first = new Triple(1, 3, 2).GetHashCode();
        int second = new Triple(1, 3, 2).GetHashCode();
        Assert.AreEqual(first, second);
    }

    [TestMethod()]
    public void EqualsTestObjectAndTriple()
    {
        Assert.IsFalse(new Triple(2, 3, 4).Equals(DateTime.Now)); 
    }

    [TestMethod()]
    public void ToStringTest()
    {
        Triple target = new Triple(1, 66, 43); 
        string expected = "1,66,43"; 
        string actual = target.ToString();
        Assert.AreEqual(expected, actual);
    }
}